/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol.passive;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.BCD;
import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.BIN;

/**
 * <b>(DianlanParameterConfig)</b>
 * <p>
 * 参数配置,GBT-27930 充电桩与 BMS 参数配置阶段报文
 * 帧类型码 0x17
 * 序列号域 0016
 * 数据长度 49
 * 帧校验域 D18A
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/22
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@Accessors(chain = true)
public class DianlanParameterConfig {
    /** 交易流水号 */
    @DianlanProtocol(length = 16, start = 0, end = 16, dataType = BCD)
    String transNo;
    /** 桩编码 不足 7 位补 0 */
    @DianlanProtocol(length = 7, start = 16, end = 23, dataType = BCD)
    String stubNo;
    /** 充电枪号 */
    @DianlanProtocol(length = 1, start = 23, end = 24, dataType = BCD)
    String chargingPortNo;
    /** BMS 单体动力蓄电池最高允许充电电压 0.01 V/位，0 V 偏移量； 数据范围：0~24 V */
    @DianlanProtocol(length = 2, start = 24, end = 26, dataType = BIN)
    String maxAllowChargingVoltage;
    /** BMS 最高允许充电电流 0.1 A/位，-400A 偏移量 */
    @DianlanProtocol(length = 2, start = 26, end = 28, dataType = BIN)
    String maxAllowChargingCurrent;
    /** BMS 动力蓄电池标称总能量 0.1 kWh/位，0 kWh 偏移量； 数据范围：0~1000 kWh */
    @DianlanProtocol(length = 2, start = 28, end = 30, dataType = BIN)
    String nominalTotalCurrent;
    /** BMS 最高允许充电总电压 0.1 V/位，0 V 偏移量 */
    @DianlanProtocol(length = 2, start = 30, end = 32, dataType = BIN)
    String maxAllowChargingTotalVoltage;
    /** BMS 最高允许温度 1ºC/位，-50 ºC 偏移量；数据范围：-50 ºC ~+200 ºC */
    @DianlanProtocol(length = 1, start = 32, end = 33, dataType = BIN)
    String maxAllowTemperature;
    /** BMS 整车动力蓄电池荷电状态(SOC) 0.1%/位，0%偏移量；数据范围：0~100% */
    @DianlanProtocol(length = 2, start = 32, end = 33, dataType = BIN)
    String chargeState;
    /** BMS 整车动力蓄电池当前电池电压 */
    @DianlanProtocol(length = 2, start = 33, end = 35, dataType = BIN)
    String totalVoltage;
    /** 电桩最高输出电压 0.1 V /位，0 V 偏移量 */
    @DianlanProtocol(length = 2, start = 35, end = 37, dataType = BIN)
    String maxOutputVoltage;
    /** 电桩最低输出电压 0.1 V /位，0 V 偏移量 */
    @DianlanProtocol(length = 2, start = 37, end = 39, dataType = BIN)
    String miniOutputVoltage;
    /** 电桩最高输出电流 0.1 A/位，-400 A 偏移量 */
    @DianlanProtocol(length = 2, start = 39, end = 41, dataType = BIN)
    String maxOutputCurrent;
    /** 电桩最低输出电流 0.1 A/位，-400 A 偏移量 */
    @DianlanProtocol(length = 2, start = 41, end = 43, dataType = BIN)
    String miniOutputCurrent;
}